package com.pcbly.web.components.utils;

import java.util.Date;

public class LightsoftNumbFormatUtils {
	
	public static void formatNumber(String format,int lastNum){
		String date=DateHelper.dateToStr(new Date(), "yyyyMMdd");
		format=format.replaceAll("yyyyMMdd",date);
		String last=format.substring(format.lastIndexOf("-")+1,format.length());
		System.out.println(format.substring(format.lastIndexOf("-")+1,format.length()));
		System.out.println(format.substring(0,format.lastIndexOf("-")));
		lastNum=lastNum+1;
		int num=last.length()-(lastNum+"").length();
		last="";
		for(int i=0;i<num;i++){
			last+="0";
		}
		last+=lastNum;
		System.out.println(last);
		last=format.substring(0,format.lastIndexOf("-")+1)+last;
		System.out.println(last);
//		format=format.substring(format.lastIndexOf("-"),format.length());
	}
	public static void main(String[] args){
		LightsoftNumbFormatUtils.formatNumber("FXDD-yyyyMMdd-000001",2);
		System.out.println("============================");
		LightsoftNumbFormatUtils.formatNumber("FxDD-yyyyMMdd-000001",22);
		System.out.println("============================");
		LightsoftNumbFormatUtils.formatNumber("FxDD-yyyyMMdd-000001",222);
		System.out.println("============================");
		LightsoftNumbFormatUtils.formatNumber("FxDD-yyyyMMdd-000001",2222);
		System.out.println("============================");
		LightsoftNumbFormatUtils.formatNumber("FxDD-yyyyMMdd-000001",22222);
		System.out.println("============================");
		LightsoftNumbFormatUtils.formatNumber("FxDD-yyyyMMdd-000001",222222);
	}
}
